﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Text;

namespace CookieFreeHTTPModule
{
    public class CookieFreeModule : IHttpModule
    {

        public void Init(HttpApplication app)
        {
            
            app.BeginRequest += new EventHandler(PostRequestHandlerExecute);
            
        }

        public void Dispose() { }
        public delegate void MyEventHandler(Object s, EventArgs e);
        private MyEventHandler _eventHandler = null;
        public event MyEventHandler MyEvent
        {
            add { _eventHandler += value; }
            remove { _eventHandler -= value; }
        }



        public void PostRequestHandlerExecute(Object s, EventArgs e)
        {
            HttpApplication app = s as HttpApplication;
            CookieFreeAnalytics.CFA_Core.TrackVisit();
            if (_eventHandler != null)
                _eventHandler(this, null);
        }



    }
}
